package com.base.myproject.client.busi.storeslist;

import com.base.myproject.client.ui.BaseTabPanel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;

/**
 * 关于库存操作的panel，里面记录关于库存的相关操作
 * 有bug，ie不能使用
 * @author Administrator
 *2010-3-3
 * javazgw@gmail.com
 */
public class StoresListPanel extends LayoutContainer{
//	 Anchor a1 = new Anchor("<img src=‘images//64//feasibility_study.png’><a href='javascript:void(0);'><b><font color=\"#6495ed\">公司采购新产品</font></b></a>",false);
//	 Anchor a2 = new Anchor("<a href='javascript:void(0);'><b><font color=\"#6495ed\">产品转移</font></b></a>",false);
//	 Anchor a3 = new Anchor("<a href='javascript:void(0);'><b><font color=\"#6495ed\">产品销售</font></b></a>",false);
//	 Anchor a4 = new Anchor("<a href='javascript:void(0);'><b><font color=\"#6495ed\">消费者使用产品</font></b></a>",false);
	 Anchor a1 = new Anchor("公司采购新产品",false);
	 Anchor a2 = new Anchor("产品转移",false);
	 Anchor a3 = new Anchor("产品销售",false);
	 Anchor a4 = new Anchor("消费者使用产品",false);
	
	public StoresListPanel()
	{
		init();
		
	}
	
	private void init() {
		a1.addClickHandler(getClickHandler());
		a2.addClickHandler(getClickHandler());
		a3.addClickHandler(getClickHandler());
		a4.addClickHandler(getClickHandler());
		initwidget();
		
	}

	private void initwidget() {

		
		LayoutContainer panel = new LayoutContainer();
		//panel.setHeaderVisible(false);
//		panel.setAutoHeight(true);
//		panel.setAutoWidth(true);
		
		Image i = new Image("images//64//feasibility_study.png");
		Image i2 = new Image("images//64//groups.png");
		Image i3 = new Image("images//64//materials.png");
		Image i4 = new Image("images//64//outsource.png");
		
		Label label1 = new Label("备注");
		Label label2 = new Label("备注");
		Label label3 = new Label("备注");
		Label label4 = new Label("备注");
		
		TableLayout tl = new TableLayout(3);
		TableData td = new TableData();
		td.setRowspan(1);
		td.setColspan(1);
		td.setPadding(10);
		td.setHorizontalAlign(HorizontalAlignment.LEFT);
		td.setVerticalAlign(VerticalAlignment.MIDDLE);
		
		
		panel.setLayout(tl);
		panel.add(i, td);
		panel.add(a1, td);
		panel.add(label1, td);
		panel.add(i2, td);
		
		panel.add(a2, td);
		panel.add(label2, td);
		panel.add(i3, td);
		
		panel.add(a3, td);
		panel.add(label3, td);
		panel.add(i4, td);
		panel.add(a4, td);
		panel.add(label4, td);
		
		//panel.setHeaderVisible(false);
		panel.setSize(400, 400);
		this.setLayout(new CenterLayout() );
//		BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
//
//		 
//		 centerData.setMargins(new Margins(5, 5, 5, 5));  
		 this.add(panel);
		// this.add(new Button("sssss"),centerData);
		
		
	}

	private ClickHandler getClickHandler()
	{
		ClickHandler clickhandler = new ClickHandler()
		{

			@Override
			public void onClick(ClickEvent event) {
				if(event.getSource().equals(a1))
				{
					 StoreinPre ss = new StoreinPre("");
					 ss.StoreoutPreDialog();
				}
				else if(event.getSource().equals(a2))
				{
					
					MessageBox.alert("提示", "Demo 不提供，根据用户需求制作", null);
//					StoreinCp w =new com.base.myproject.client.busi.storeslist.StoreinCp();
//					w.complete();
//					BaseTabPanel.getInstance().addTab("入库确认", w);
				}
					
				else if(event.getSource().equals(a3))
				{
					StoreoutPre s = new StoreoutPre("");
					 s.StoreoutPreDialog();
				}
				else if(event.getSource().equals(a4))
				{
					
					MessageBox.alert("提示", "Demo 不提供，根据用户需求制作", null);
//					StoreinCp w =new com.base.myproject.client.busi.storeslist.StoreinCp();
//					w.complete();
//					BaseTabPanel.getInstance().addTab("入库确认", w);
				}
				
			}
			
		};
		return clickhandler;
	}
	

}
